package cn.ycl.system.biz.service.controller;

import cn.ycl.system.biz.service.entity.ProductService;
import cn.ycl.system.biz.service.service.ProductServiceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (ProductService)表控制层
 *
 * @author yuanchangliang
 * @since 2021-09-30 16:46:54
 */
@RestController
@RequestMapping("/productService")
public class ProductServiceController {
    /**
     * 服务对象
     */
    @Resource
    private ProductServiceService productServiceService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectOne")
    public ProductService selectOne(Long id) {
        return this.productServiceService.queryById(id);
    }

    /**
     * 获取前10条数据
     *
     * @return 单条数据
     */
    @GetMapping("/selectAll")
    public List<ProductService> selectAll() {
        return this.productServiceService.queryAllByLimit(0, 10);
    }

}
